package db;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class UserEntity extends Entity {

	public AttributeEntity getAttribute() {
		return _attribute;
	}

	private AttributeEntity _attribute;

	public String getName() {
		return _name;
	}

	private String _name;

	@Override
	protected Entity mapToObj(ResultSet rs) {
		UserEntity ie = new UserEntity();
		try {
			ie._id = rs.getInt("user_id");
			ie._name = rs.getString("user_name");

		} catch (Exception e) {
			e.printStackTrace();
		}

		return ie;

	}

	@Override
	protected void fillPreparedParams(PreparedStatement ps) {
		try {
			ps.setObject(1, "user_name");
			ps.setObject(2, _name);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	@Override
	protected String getIdCol() {
		return "user_id";
	}

	@Override
	protected int getNoCols() {
		return 1;
	}

	@Override
	protected String getTblname() {
		return "users";
	}

}
